<script language="javascript">
function post()
{
var search_val = $('#u').val();
document.univ.action = "index.php?page=universities&view=univ&srch_id="+search_val;
document.univ.method="post";
document.univ.submit();	
}

function post_course()
{

var search_val = $('#c').val();

document.course.action = "index.php?page=universities&view=course&srch_id="+search_val;
document.course.method="post";
document.course.submit();	
}
function post_s()
{

var search_val = $('#s').val();
if(search_val == "") {
alert("Search Query Required");
document.getElementById('s').focus();
return false;
}
document.scholar.action = "index.php?page=universities&view=scholar&srch_id="+search_val;
document.scholar.method="post";
document.scholar.submit();	
}

</script>

    <div class="contentwarp">
      <!-- Begin contentwarpMiddle -->
      <div class="contentwarpMiddle"> <?php  if($_GET['view']==""){    ?> 
        <div class="UniversityLeft" style="padding-top:10px;">
        
          <table width="230" border="0" cellpadding="2" cellspacing="2">
            <tr>
              <td width=25% align=left valign=top><table width="230" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><font color=000000><b>Search Resources</b></font>
                  </tr>
                </table>
                
                <table width="230" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td> </td>
                  </tr>
                  <tr>
                    <td><font color="#0488B9"><b>Search by Universities</b></font>
                    </td>
                  </tr>
                </table>
                <table width="230" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><form action="#" name="univ" method="post" >
                      <select name="u" id="u" style="width:220px" class="txtborder" onchange="window.open(this.options[this.selectedIndex].value,'_blank')">
                  
                 	 <?php  echo $base_obj->listUniversities($gad_id)?>	
                      </select>
                       
                      </form></td>
                  </tr>
                  
                </table>
                <table width="230" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                     <td><font color="#0488B9"><b>Search by Courses</b></font>
                    </td>
                  </tr>
                </table>
                <table width="230" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><form action="#" name="course" method="post" onSubmit="return post_course();">
                       <select name="c" id="c" style="width:220px" class="txtborder" onchange="window.open(this.options[this.selectedIndex].value,'_blank')">
                     
                 	 <?php  echo $base_obj->listCourse($id)?>	
                      </select>
                       
                       
                        <br>
                      
                      </form></td>
                  </tr>
                </table>
                <table width="230" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                     <td><font color="#0488B9"><b>Resource Center</b></font>
                    </td>
                  </tr>
                </table>
                <table width="230" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><!--<form method="post" name="scholar" action="#" onSubmit="return post_s();">
                        <input type="text" name="s" id="s" size="21" />
                        <input type="submit" value="Search" />
                       
                      
                      </form>-->
                      <form action="#" name="course" method="post" onSubmit="return post_course();">
                       <select name="c" id="c" style="width:220px" class="txtborder" onchange="window.open(this.options[this.selectedIndex].value,'_blank')">
                     
                 	 <?php  echo $base_obj->listScholarname($id)?>	
                      </select>
                       
                       
                        <br>
                      
                      </form>
                      </td>
                  </tr>
                </table>
                <table width="230" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                     <td><font color="#0488B9"><b>Search by State</b></font>
                    </td>
                  </tr>
                </table>
                <table width="230" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td>  <div class="contentArea2 mapWrap">
          <div class="mapAusSmall"> <span class="mapAusSmallWa">
          <a href="index.php?page=universities&view=area&a_id=Western%20Australia" title="Western Australia"></a></span> <span class="mapAusSmallNt">
          <a href="index.php?page=universities&view=area&a_id=Northern%20Territory" title="Northern Territory"></a></span> <span class="mapAusSmallQu">
          <a href="index.php?page=universities&view=area&a_id=Queensland" title="Queensland"></a></span> <span class="mapAusSmallSa">
          <a href="index.php?page=universities&view=area&a_id=South%20Australia" title="South Australia"></a></span> <span class="mapAusSmallNsw">
          <a href="index.php?page=universities&view=area&a_id=New%20South%20Wales" title="New South Wales"></a></span> <span class="mapAusSmallVic">
          <a href="index.php?page=universities&view=area&a_id=Victoria" title="Victoria"></a></span> <span class="mapAusSmallAct">
          <a href="index.php?page=universities&view=area&a_id=Australian%20Capital%20Territory" title="Australian Capital Territory"></a>
          </span> <span class="mapAusSmallTas">
          <a href="index.php?page=universities&view=area&a_id=Tasmania" title="Tasmania"></a></span> </div>
        </div>                   
                      </td>
                  </tr>
                </table>
                
                </td>
            </tr>
          </table>
         
        </div> <?php } ?>
        <div  class="TechnologyTbl" style="min-height:630px; padding-top:150px;"><form name="vote_form" method="post">
      
           <?php if($_GET['view']==""){      
                echo '<h3>Recent Scholarships</h3>';
				  
                $qry="select * from scholarships where (select max(id) from scholarships)   
				and active_status ='1' order by id desc limit 0,2";
				$res = $base_obj->exec_query($qry);
				$data = $base_obj->fetch_row_all($res);	
				$count = count($data);
				for($i=0;$i<$count;$i++) 
				{
				   echo '<table border="0" class="">
					<tr>
					<td colspan=2> <span style="font-size:14px; color:#0488B9; font-weight:bold" >  '.stripcslashes($data[$i]['scholarship_name']).'
					</span></td></tr>
					<tr>
					<td valign="top">'.stripcslashes($data[$i]['details_description']).'
					</td></tr>
					</table><br>';	
				}}
				
				else if($_REQUEST['view']=='univ')
				{
					echo '<h3>University</h3>';
					 			  
                /*$qry="select s.id id,s.scholarship_name, s.details_description, s.duration, s.extra_details, s.general_info, s.eligible_instruction,s.university_id,s.active_status,s.url,s.email,s.phone,u.university_name,c.course_name from scholarships s left join university u on u.id=s.university_id left join  course c on c.id=s.`course_id`  where university_id ='".$_GET['srch_id']."'
				
				and s.active_status ='1' order by id desc";*/
			 	$qry="select u.id,university_name,address, `location`, `city`, `zone`, `description`, `phone`, `email`, `url`,z.zone_name,c.city_name  from university u
				LEFT join zone z on  u.zone=z.id 
				LEFT JOIN 
				city c ON c.city_id=u.city
				
				where  u.id ='".$_GET['srch_id']."'";
				$res = $base_obj->exec_query($qry);
				$data = $base_obj->fetch_row_all($res);	
				
				$count = count($data);
				if($count>0){
				for($i=0;$i<$count;$i++) 
				{
					
				
				   echo '<br><table border="0">
				  <tr>
					<td width=150px; colspan=2>
					 <font color=#0488B9><b>'.$data[$i]['university_name'].'</b>:</font></td>
					 </td>
					</tr>
					<tr>
					<td colspan=2> <span style="font-size:14px; color:#0488B9; font-weight:bold" >'.stripcslashes($data[$i]['description']).'</span><div style="float:right;">
					</td></tr>
					
					<tr>
					<td colspan=2 valign="top">'.stripcslashes($data[$i]['details_description']).'</td></tr>
					<tr><td width=150px;>
					 <font color=#0488B9><b>Zone </b>:</font></td><td>'.$data[$i]['zone_name'].'
					 </td></tr>
					 <tr><td valign="top">
					<font color=#0488B9><b>City</b>:</font></td><td>'.$data[$i]['city_name'].'
					</td></tr>
					</tr>
					 
					 
					<tr><td valign="top">
					<font color=#0488B9><b>Organisation Information</b>:</font></td><td>
					Location:'.$data[$i]['address'].'<br><br>
					Website:<a href="'.$data[$i]['url'].'">'.$data[$i]['url'].'</a><br><br>
					E mail:<a href="mailto:'.$data[$i]['email'].'">'.$data[$i]['email'].'</a><br><br>
					Contact:'.$data[$i]['phone'].'<br><br>
					</td></tr>
					</table><br>';	
				}
				}
				else
				{
					echo '<p style="text-align:center;font-weight:bold;color:#0488B9;">No Details Found For this Search </p>';
					
				}
				}
				else if($_REQUEST['view']=='course')
				{
					echo '<h3>Course </h3>';
				  
              /*  $qry="select s.id id,s.scholarship_name, s.details_description, s.duration, s.extra_details, s.general_info, s.eligible_instruction,s.active_status,u.university_name,s.url,s.email,s.phone,c.course_name from scholarships s left join university u on u.id=s.university_id left join  course c on c.id=s.`course_id`  where course_id ='".$_GET['srch_id']."'
				and s.active_status ='1' order by id desc";*/
			$qry="select  `course_name`, `desc`,u.university_name,u.address, u.location, u.phone, u.email,z.zone_name,ci.city_name  from course c  LEFT JOIN university u on  u.id=c.univer_id
			LEFT JOIN
			 zone z on  u.zone=z.id 
			 LEFT JOIN 
				city ci ON ci.city_id=u.city
				where  c.id ='".$_GET['srch_id']."' and c.active_status='1'";	
				$res = $base_obj->exec_query($qry);
				$data = $base_obj->fetch_row_all($res);	
				
				$count = count($data);
				if($count>0){
				for($i=0;$i<$count;$i++) 
				{
					
				
				   echo '<br><table border="0" width="100%">
				  <tr>
					<td width=150px; colspan=2>
					 <font color=#0488B9><b>'.$data[$i]['course_name'].'</b>:</font></td>
					 </td>
					</tr>
					<tr>
					<td colspan=2> <span style="font-size:14px; color:#0488B9; font-weight:bold" >'.stripcslashes($data[$i]['description']).'</span><div style="float:right;">
					</td></tr>
					
					<tr>
					<td colspan=2 valign="top">'.stripcslashes($data[$i]['desc']).'</td></tr>
					<tr><td width=150px;>
					 <font color=#0488B9><b>University </b>:</font></td><td>'.$data[$i]['university_name'].'
					 </td></tr>
					<tr><td width=150px;>
					 <font color=#0488B9><b>Zone </b>:</font></td><td>'.$data[$i]['zone_name'].'
					 </td></tr>
					 <tr><td valign="top">
					<font color=#0488B9><b>City</b>:</font></td><td>'.$data[$i]['city_name'].'
					</td></tr>
					 
					<tr><td valign="top">
					<font color=#0488B9><b>Organisation Information</b>:</font></td><td>
					Location:'.$data[$i]['address'].'<br><br>
					Website:<a href="'.$data[$i]['url'].'">'.$data[$i]['url'].'</a><br><br>
					E mail:<a href="mailto:'.$data[$i]['email'].'">'.$data[$i]['email'].'</a><br><br>
					Contact:'.$data[$i]['phone'].'<br><br>
					</td></tr>
					</table><br>';		
				}
				}
				else
				{
					echo '<p style="text-align:center;font-weight:bold;color:#0488B9;">No Details Found For this Search </p>';
					
				}
				}
				else if($_REQUEST['view']=='scholar')
				{
					echo '<h3>ScholarShip </h3>';
				  
               $qry="select s.id id,s.scholarship_name, s.details_description, s.duration, s.extra_details, s.general_info, s.eligible_instruction,s.active_status,u.university_name,s.url,s.email,s.phone,c.course_name from scholarships s left join university u on u.id=s.university_id left join  course c on c.id=s.`course_id`  where scholarship_name like '%".$_GET['srch_id']."%'
				and s.active_status ='1' order by id desc";
				$res = $base_obj->exec_query($qry);
				$data = $base_obj->fetch_row_all($res);	
				
				$count = count($data);
				if($count>0){
				
				
				  	for($i=0;$i<$count;$i++) 
				{
					
				
				   echo '<table border="0" class="">
					<tr>
					<td colspan=2> <span style="font-size:14px; color:#0488B9; font-weight:bold" >'.stripcslashes($data[$i]['scholarship_name']).'</span></td></tr>
					<tr>
					<td colspan=2 valign="top">'.stripcslashes($data[$i]['details_description']).'</td></tr>
					<tr><td width=150px;>
					 <font color=#0488B9><b>Duration and Value </b>:</font></td><td>'.$data[$i]['duration'].'
					 </td></tr>
					 <tr><td valign="top">
					<font color=#0488B9><b>Eligibility criteria</b>:</font></td><td>'.$data[$i]['eligible_instruction'].'
					</td></tr>
					 <tr><td valign="top">
					<font color=#0488B9><b>General Information</b>:</font></td><td>'.$data[$i]['general_info'].'
					</td></tr>
					 <tr><td valign="top">
					<font color=#0488B9><b>Extra Information</b>:</font></td><td>'.$data[$i]['extra_details'].'
					</td></tr>
					<tr><td valign="top">
					<font color=#0488B9><b>Organisation Information</b>:</font></td><td>
					
					Website:'.str_replace("http://","",$data[$i]['url']).'<br>
					E mail:'.$data[$i]['email'].'<br>
					Phone:'.$data[$i]['phone'].'<br>
					</td></tr>
					</table><br>';	
				}
				}
				else
				{
					echo '<p style="text-align:center;font-weight:bold;color:#0488B9;">No Scholarships Found For this Search </p>';
					
				}
				}

					
				
			
			else if($_REQUEST['view']=='area')
				{ ?><br />
				<div style="min-height:150px; width:700px; background-color:#F8F8F8; border:#ccc solid 1px; margin-left:15px;">
               <h3> <font color="#0488B9"><b>List of  Universities in <?php  echo $_GET['a_id']?></b></font></h3>
        <?php 
		 $sql="select u.id,u.university_name from zone z inner join university u on z.id=u.zone where  
			z.zone_name like'%".$_GET['a_id']."%' and u.active_status='1'";
			$res = $base_obj->exec_query($sql);
			$data = $base_obj->fetch_row_all($res);	
			$count = count($data);
		if($count>0)
		{
			for($i=0;$i<$count;$i++) 
				{
			 echo '<span style="margin-left:10px;"><a href="index.php?page=universities&view=univ&srch_id='.$data[$i][id].'">'.$data[$i][university_name].'</a></span><br>';
			 }
		}
		else
		{
			echo '<p style="text-align:center;font-weight:bold;color:#0488B9;">No Active University\'s  Found  </p>';
		}
			?>
        </div>
				
				<?php }
				
				
				?>    
                   
        
       </form> </div>
      </div>
      
      <!-- End contentwarpMiddle -->
      
     
      
      <!-- End contentwarp -->
       <?php include("includes/right_content.php");?>
      <div style="clear:both;"></div>
    </div>
    <!-- End mainWarpArea -->
    <div style="clear:both;"></div>
  </div>
